home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / PACKET / UPDAT630 / BPQPATCH.TXT < prev    next >
Text File  |  1997-09-30  |  5KB  |  105 lines

  1. Summary
  2. -------
  3. These copies of BPQDLL.DLL, PAC4.EXE and SWITCH.EXE have been patched
  4. to fix a problem which very occasionally occurs when decoding nodes
  5. broadcasts. The problem manifests itself as a GPF in BPQDLL.DLL if the
  6. Windows application using it calls the function which decodes monitored
  7. frames, and a crash in PAC4.EXE and SWITCH.EXE if monitoring is enabled.
  8. The problem occurs very rarely, because, for a nodes broadcast to
  9. trigger it, the broadcast itself must have a very unusual structure!
  10.  
  11. The problem was discovered as a result of GPFs occurring when using
  12. BPQDLL.DLL with WinPack, also crashes in PAC4.EXE were noted. I would
  13. like to thank G4ZEC, who was lucky, or unlucky, enough to regularly get
  14. the GPFs, for his help and persistence in tracking down this problem.
  15. Once the cause was found, a suitably constructed nodes broadcast would
  16. always crash the programs, but finding the cause was a very prolonged
  17. exercise!
  18.  
  19. The versions of the programs which have been patched were from the BPQ
  20. 4.08a release. Normally I would not consider issuing altered versions of
  21. someone else's software, but my understanding is that the author no
  22. longer actively supports the programs. The patches have no effect other
  23. than to make these programs more robust, and so I feel that, in this
  24. case, releasing the patches is justified.
  25.  
  26. Please note that the patched version of BPQDLL.DLL is *much* smaller
  27. than the original, because I have stripped some symbolic debugging
  28. information from it. This debugging information was of little use unless
  29. you had a copy of the source code from which the DLL was compiled, and I
  30. doubt if G8BPQ intended leaving it there. Removing it makes the file
  31. much smaller for sending via 7plus.
  32.  
  33. Installation
  34. ------------
  35. Replace your existing versions of these three files with these new
  36. versions.
  37.  
  38. Please check how many copies of BPQDLL.DLL you have on your PC - you can
  39. very easily finish up with Windows using the wrong copy! There should
  40. only be one copy and it should be in your Windows SYSTEM directory. On a
  41. "normal" Windows installation, with Windows installed in C:\WINDOWS, the
  42. Windows SYSTEM directory is C:\WINDOWS\SYSTEM. If your Windows is in,
  43. say, D:\WIN31, the Windows SYSTEM directory is almost certainly
  44. D:\WIN31\SYSTEM.
  45.  
  46. (There is sometimes confusion about where to put BPQDLL.DLL because of
  47. the special arrangments that are sometimes needed for BPQCODE.386. There
  48. is nothing special needed for BPQDLL.DLL, it behaves exactly like any
  49. other Windows DLL.)
  50.  
  51. Technical Details
  52. -----------------
  53. BPQDLL.DLL, PAC4.EXE and SWITCH.EXE use very similar code to interpret
  54. received nodes broadcasts for displaying on the screen. In this code the
  55. CX register is used as a length countdown counter for the frame being
  56. decoded. In some rare situations the length count will go below zero, as
  57. a result of a node transmitting superfluous bytes on the end of a nodes
  58. broadcast. The original code attempted to allow for this using:-
  59.  
  60.     cmp  cx, 0
  61.     jbe  <address>
  62.  
  63. However, this is not valid because JBE is an unsigned test and this jump
  64. will in fact only occur if CX = 0. Therefore if CX gets decremented
  65. below zero, another 65,535 or so non-existant bytes of the frame are
  66. decoded, causing a crash in PAC4, a crash in SWITCH.EXE and a GPF in
  67. BPQDLL.DLL.
  68.  
  69. I have changed it to:-
  70.  
  71.     cmp  cx, 21
  72.     jl   <address>
  73.  
  74. The comparison is now made correctly using JL, which is a signed
  75. comparison. Also, the interpretation stops if there are less than 21
  76. bytes left, because anything less than that must be garbage. (This is
  77. because of the particular structure of a nodes broadcast.)
  78.  
  79. Should anyone want to examine the patch, the patch addresses in the
  80. files are:-
  81.  
  82. BPQDLL.DLL - 0F66h
  83. PAC4.EXE   - 0EEFh
  84. SWITCH.EXE - 6A16h
  85.  
  86. Note that these are the absolute offsets in the files, they will not be
  87. the correct addresses when the programs are run in a debugger.
  88.  
  89. For anyone who has a detailed knowledge of the structure of a nodes
  90. braodcast, here is a sample of a captured broadcast frame which
  91. triggered the problem with the original versions of the programs. In
  92. this example there are four superfluous bytes on the end of the
  93. broadcast.
  94.  
  95. 000000: 9C 9E 88 8A A6 40 60 8E  70 AC 9A 98 40 73 03 CF .....@`.p...@s..
  96. 000010: FF 53 43 4F 55 54 37 8E  70 9E B0 A6 40 70 48 44 .SCOUT7.p...@pHD
  97. 000020: 4F 57 4E 20 8E 60 A4 A4  8E 40 6F 38 8E 60 A4 A4 OWN .`...@o8.`..
  98. 000030: 8E 40 6F 4E 57 37 32 20  20 8E 60 A4 A4 8E 40 6F .@oNW72  .`...@o
  99. 000040: 96 00 10 00 00
  100.  
  101.  
  102. Roger Barker, G4IDE
  103. October 1997
  104.  
  105.